﻿using System;
using WF_AppFuel.Validation.Base;
using WF_AppFuel.Validation.Engines;

namespace WF_AppFuel.Validation.Attributes
{
    /// <summary>
    /// Attribute used for specifying that a property is required.
    /// </summary>
    /// <author>Arjay C. Nacion</author>
    public sealed class IsRequired : BaseValidationAttribute
    {
        private bool isRequired = false;

        /// <param name="isRequired">
        /// Indicates whether the property to which this attribute
        /// is set is required or not. True if required, false otherwise.
        /// </param>
        public IsRequired(bool isRequired)
        {
            this.SetValidationMessage("Is Required");
            this.isRequired = isRequired;
        }

        public override Type ValidationEngineType
        {
            get { return typeof(IsRequiredValidationEngine); }
        }

        public bool Required { get { return this.isRequired; } }
    }
}